package ldh.im.rpc.buffer;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public interface RpcBuffer {

    int getReadIdx();
    int getWriteIdx();

    int readable();

    int writeable();

    void writeBytes(byte[] bytes);

    void writeBytes(byte[] bytes, int start, int length);

    void writeShort(short value);

    void writeInt(int value);

    void writeByte(byte bb);

    void readBytes(byte[] bytes);

    short readShort();

    int readInt();

    void discard();

    void markReadIdx();

    void resetMarkReadIdx();

    void markWriteIdx();

    void resetMarkWriteIdx();

    void writeToStream(OutputStream outputStream) throws IOException;

    int readFromStream(InputStream inputStream, int length) throws IOException;

    void ensureSize(int size);

    byte[] array();

    void skip(int length);
}
